<template>
    <div class="tarot-result">
        <h2 class="tarot-title">命运的指引</h2>
        <div class="tarot-image">
            <img
                :class="data.direction == '逆位' ? 'reversed' : ''"
                :src="data.img_url"
                alt=""
            />
        </div>
        <div class="tarot-name">
            <h3>{{ data.name }}</h3>
            <h3>{{ data.direction }}</h3>
        </div>
        <div class="tarot-desc" v-html="data.answer"></div>
        <button class="tarot-btn" @click="handleClick">重新讲出我的疑惑</button>
    </div>
</template>

<script setup lang="ts" name="tarotResult">
import router from "../router";
import getImg from "../plugin/getImg";
import { onMounted, ref } from "vue";
import { layer } from "@layui/layui-vue";
const data = history.state;
const img_url: any = ref("");
const handleClick = () => {
    router.push({ path: "/" });
};
</script>

<style lang="scss" scoped>
.tarot-result {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    .tarot-title {
        margin-bottom: 2rem;
        font-weight: 600;
        background: radial-gradient(#a531dc, #4300b1);
        /*设置渐变的方向从左到右 颜色从ff0000到ffff00*/
        -webkit-background-clip: text;
        /*将设置的背景颜色限制在文字中*/
        -webkit-text-fill-color: transparent;
        /*给文字设置成透明*/
    }
    .tarot-image {
        width: 12rem;
        height: 16rem;
        border: 1px solid #000;
        margin-bottom: 2rem;
        .reversed {
            transform: scaleY(-1);
        }
        img {
            width: 100%;
            height: 100%;
        }
    }
    .tarot-name {
        margin-bottom: 2rem;
        h3 {
            font-weight: 600;
        }
    }
    .tarot-desc {
        font-size: 1rem;
        line-height: 2rem;
        letter-spacing: 0.1rem;
        margin-bottom: 2rem;
        width: 100%;
        height: 15rem;
        overflow-y: auto;
        white-space: pre-wrap;
    }
    .tarot-btn {
        padding: 1rem 2rem;
        font-size: 1rem;
        border-radius: 2rem;
        font-weight: 500;
        // background: linear-gradient(to right,#a531dc,#4300b1);
        background: linear-gradient(220.55deg, #8a88fb 0%, #d079ee 100%);
        color: #fff;
    }
}
</style>